package day05_api.com.itheima.d5_regex;

public class RegexTest7 {
    public static void main(String[] args) {
        // 需求1：请把 古力娜扎ai8888迪丽热巴999aa5566马尔扎哈fbbfsfs42425卡尔扎巴，中间的非中文字符替换成 “-”
        String s1 = "古力娜扎ai8888迪丽热巴999aa5566马尔扎哈fbbfsfs42425卡尔扎巴";
        String newS1 = s1.replaceAll("[^\\u4e00-\\u9fa5]", "-");
        System.out.println(newS1);

        // 需求1：请把 古力娜扎ai8888迪丽热巴999aa5566马尔扎哈fbbfsfs42425卡尔扎巴，中的人名获取出来。
        String s2 = "古力娜扎ai8888迪丽热巴999aa5566马尔扎哈fbbfsfs42425卡尔扎巴";
        String[] names = s2.split("\\w+");
        for (String name : names) {
            System.out.println(name);
        }

    }
}
